Const'ified code with Babl*'s refering to formats.
authorØyvind Kolås <ok@src.gnome.org>
Sat, 29 Dec 2007 03:29:37 +0000 (03:29 +0000)
committerØyvind Kolås <ok@src.gnome.org>
Sat, 29 Dec 2007 03:29:37 +0000 (03:29 +0000)
* babl/babl.h:
* babl/babl-classes.h:
* babl/babl-fish-path.c:
* babl/babl-fish-reference.c:
* babl/babl-fish.c:
* babl/babl-internal.[ch]: Const'ified code with Babl*'s refering to
formats.

svn path=/trunk/; revision=260

ChangeLog
babl/babl-classes.h
babl/babl-fish-path.c
babl/babl-fish-reference.c
babl/babl-fish.c
babl/babl-internal.c
babl/babl-internal.h
babl/babl.h

index 2d4aaf08cf999ab852af6c78370966e49310704c..b8c823e636712ea6d742262dfed23100476e9e19 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2007-12-29  Øyvind Kolås  <pippin@gimp.org>
+
+       * babl/babl.h:
+       * babl/babl-classes.h:
+       * babl/babl-fish-path.c:
+       * babl/babl-fish-reference.c:
+       * babl/babl-fish.c: 
+       * babl/babl-internal.[ch]: Const'ified code with Babl*'s refering to
+       formats.
+
 2007-02-17  Øyvind Kolås  <pippin@gimp.org>
 
        * configure.ac: post release version increment to 0.0.17
index 68c588aa3197d385d3aaa6e756b7d4c87f0fa4d2..52cb22fc012fde9ecdeeafe7321db3bb1ae0702d 100644 (file)
@@ -91,8 +91,8 @@ typedef struct
 typedef struct
 BablConversion {
   BablInstance           instance;
-  Babl                  *source;
-  Babl                  *destination;
+  const Babl            *source;
+  const Babl            *destination;
   long                   cost;
   double                 error;
   union
@@ -197,8 +197,8 @@ typedef struct
 typedef struct
 {
   BablInstance    instance;
-  Babl           *source;
-  Babl           *destination;
+  const Babl     *source;
+  const Babl     *destination;
 
   double          error;    /* the amount of noise introduced by the fish */
 
index 56b8e4925395e13addfacefb1b930e53e55ddd40..4fbb4757bc0c1618478b4a392d168cbaf922810c 100644 (file)
@@ -20,8 +20,8 @@
 #include "babl-internal.h"
 
 static double
-chain_error (Babl            *fmt_source,
-             Babl            *fmt_destination,
+chain_error (const Babl      *fmt_source,
+             const Babl      *fmt_destination,
              BablConversion **chain,
              int              conversions);
 
@@ -66,8 +66,8 @@ static int max_path_length (void)
 
 typedef struct BablChainContext
 {
-  Babl *from;
-  Babl *to;
+  const Babl *from;
+  const Babl *to;
 
   double *best_cost;
   double *best_loss;
@@ -87,8 +87,8 @@ chain_gen_each (Babl *babl,
                 void *userdata);
 
 static int
-get_conversion_chain (Babl            *from,
-                      Babl            *to,
+get_conversion_chain (const Babl      *from,
+                      const Babl      *to,
                       double          *best_cost,
                       double          *best_loss,
                       double          *best_error,
@@ -266,9 +266,9 @@ assert_conversion_find (void *source,
 
 static char buf[1024];
 static char *
-create_name (Babl *source,
-             Babl *destination,
-             int   is_reference)
+create_name (const Babl *source,
+             const Babl *destination,
+             int         is_reference)
 {
   /* fish names are intentionally kept short */
   snprintf (buf, 1024, "%s %p %p", "",
@@ -277,8 +277,8 @@ create_name (Babl *source,
 }
 
 Babl *
-babl_fish_path (Babl *source,
-                Babl *destination)
+babl_fish_path (const Babl *source,
+                const Babl *destination)
 {
   Babl           *babl = NULL;
   char           *name = create_name (source, destination, 1);
@@ -443,8 +443,8 @@ test_create (void)
 }
 
 static double
-chain_error (Babl            *fmt_source,
-             Babl            *fmt_destination,
+chain_error (const Babl      *fmt_source,
+             const Babl      *fmt_destination,
              BablConversion **chain,
              int              conversions)
 {
index e80b0911fd3634b4d5cfa032a07d79008722cd4b..073f7dbda61ecbdeefc04889a2fa7886a77994a9 100644 (file)
@@ -31,8 +31,8 @@ assert_conversion_find (void *source,
 
 static char buf[1024];
 static char *
-create_name (Babl *source,
-             Babl *destination,
+create_name (const Babl *source,
+             const Babl *destination,
              int   is_reference)
 {
   /* fish names are intentionally kept short */
@@ -45,8 +45,8 @@ create_name (Babl *source,
 
 
 Babl *
-babl_fish_reference (Babl *source,
-                     Babl *destination)
+babl_fish_reference (const Babl *source,
+                     const Babl *destination)
 {
   Babl *babl = NULL;
   char *name = create_name (source, destination, 1);
index 3d14b055a6717c2b640087118f0898f892c887f5..79769121f1c97bd6a79378b9fe93c6ee6e362bf4 100644 (file)
@@ -36,13 +36,13 @@ match_conversion (Babl *conversion,
 }
 
 Babl *
-babl_conversion_find (void *source,
-                      void *destination)
+babl_conversion_find (const void *source,
+                      const void *destination)
 {
-  void *data = destination;
+  void *data = (void*)destination;
 
   babl_list_each ((void *) BABL (source)->type.from, match_conversion, &data);
-  if (data == destination)
+  if (data == (void*)destination) /* didn't change */
     return NULL;
   return data;
 }
@@ -56,8 +56,8 @@ babl_fish_db (void)
 }
 
 static inline Babl *
-go_fishing (Babl *source,
-            Babl *destination)
+go_fishing (const Babl *source,
+            const Babl *destination)
 {
   BablDb *db = babl_fish_db ();
   int i;
@@ -78,12 +78,12 @@ go_fishing (Babl *source,
 }
 
 Babl *
-babl_fish (void *source,
-           void *destination,
+babl_fish (const void *source,
+           const void *destination,
            ...)
 {
-  Babl *source_format      = NULL;
-  Babl *destination_format = NULL;
+  const Babl *source_format      = NULL;
+  const Babl *destination_format = NULL;
 
   babl_assert (source);
   babl_assert (destination);
index 785821fb3e2cc42f92d4e3453a21c62e71b23e7a..8de4ce59c36bd2459b4b4c1ee1057c5bedacd731 100644 (file)
@@ -132,7 +132,7 @@ babl_internal_destroy (void)
 
 
 const char *
-babl_name (Babl *babl)
+babl_name (const Babl *babl)
 {
   babl_assert (BABL_IS_BABL (babl));
   return babl->instance.name;
index e1b4cc4864541e058606e9f6ee72ebcde2063acc..9afac6fe520351119a6a5f01d12a17f32b9c59a8 100644 (file)
@@ -49,8 +49,8 @@
 #define random  rand
 #endif
 
-Babl   * babl_conversion_find           (void           *source,
-                                         void           *destination);
+Babl * babl_conversion_find       (const void     *source,
+                                         const void     *destination);
 double   babl_conversion_error          (BablConversion *conversion);
 long     babl_conversion_cost           (BablConversion *conversion);
 long     babl_conversion_process        (Babl           *conversion,
@@ -75,12 +75,12 @@ long     babl_fish_reference_process    (Babl           *babl,
                                          long            n);
 
 BablDb * babl_fish_db                   (void);
-Babl   * babl_fish_reference            (Babl           *source,
-                                         Babl           *destination);
+Babl   * babl_fish_reference            (const Babl     *source,
+                                         const Babl     *destination);
 Babl   * babl_fish_simple               (BablConversion *conversion);
 void     babl_fish_stats                (FILE           *file);
-Babl   * babl_fish_path                 (Babl           *source,
-                                         Babl           *destination);
+Babl   * babl_fish_path                 (const Babl     *source,
+                                         const Babl     *destination);
 
 long     babl_fish_path_process         (Babl           *babl,
                                          void           *source,
index 3553ae7bcdb9c307b4b9f22640b1207cc6d90807..739c2772405438a1163b051945ec663e8dbd7b9e 100644 (file)
@@ -72,8 +72,8 @@ typedef int  (*BablEachFunction) (Babl *entry,
  *  destination_format, source and destination can be
  *  either strings with the names of the formats or BablFormat objects.
  */
-Babl * babl_fish       (void *source_format,
-                        void *destination_format,
+Babl * babl_fish       (const void *source_format,
+                        const void *destination_format,
                         ...);
 
 /** Process n pixels from source to destination using babl_fish,
@@ -189,7 +189,7 @@ Babl * babl_sampling   (int horizontal,
  */  
 
 
-const char *babl_name (Babl *babl);  /* returns the name of a babl object */
+const char *babl_name (const Babl *babl);  /* returns the name of a babl object */
 void   babl_introspect (Babl *babl); /* introspect a given BablObject     */
 
 #undef BABL_CLASS